package com.hackerrank.challenges.closestnumbers;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Solution {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), ar[] = new int[n];
		for(int i = 0; i < n; i++)
			ar[i] = in.nextInt();
		Arrays.sort(ar);
		int md = Integer.MAX_VALUE;
		ArrayList<Integer> l1 = new ArrayList<Integer>(), l2 = new ArrayList<Integer>();
		for(int i = 1; i < n; i++) {
			int d = ar[i] - ar[i - 1];
			if(d < md) {
				md = d;
				l1.clear();
				l2.clear();
			}
			if(d <= md) {
				l1.add(ar[i - 1]);
				l2.add(ar[i]);
			}
		}
		for(int i = 0; i < l1.size(); i++)
			System.out.print(l1.get(i) + " " + l2.get(i) + " ");
		System.out.println();
	}
}
